package com.qf.xiaomi.web.servlet;

import cn.dsna.util.images.ValidateCode;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 * @Created by 马英超 on 2022/8/16 20:57
 * @author： 马英超
 * @version：v1.0
 * @description:
 */
public class CodeServlet {

    protected void createCode(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //
        ValidateCode validateCode=new ValidateCode(112,30,1,20);
        validateCode.createCode();
        String code = validateCode.getCode();
         HttpSession httpSession = req.getSession();
        httpSession.setAttribute("code",code);
        validateCode.write(resp.getOutputStream());

    }
}
